﻿<Window x:Class="MiniUML.View.Windows.NewDocumentWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:viewconv="clr-namespace:MiniUML.View.Converter"
        SizeToContent="WidthAndHeight"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        WindowState="Normal"
        Icon="{DynamicResource ApplicationIcon}">

    <Window.Resources>
      <viewconv:DiuToCentimetersConverter x:Key="LengthConverter"/>
    </Window.Resources>
    
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Margin="10,10,10,0" Foreground="#FF003399" FontSize="16" Text="Create new document"/>

        <StackPanel Grid.Row="2" Margin="10,5,10,16" >

            <GroupBox Grid.Row="2"
                      Padding="2"
                      SnapsToDevicePixels="True"
                      BorderThickness="1"
                      BorderBrush="#FFDFDFDF"
                      Header="Page size">

                <Grid>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="35"/>
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Column="0" VerticalAlignment="Center" Text="Width:"/>
                    <TextBox x:Name="_pageWidthTextBox" Grid.Column="1" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageSize.Width, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Column="2" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>
                    
                    <TextBlock Grid.Column="3" Margin="0,5,5,5" VerticalAlignment="Center" Text="Height:"/>
                    <TextBox x:Name="_pageHeightTextBox" Grid.Column="4" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageSize.Height, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Column="5" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>

                </Grid>

            </GroupBox>

            <GroupBox Grid.Row="2"
                      Margin="0,10,0,0"
                      Padding="2"
                      SnapsToDevicePixels="True"
                      BorderThickness="1"
                      BorderBrush="#FFDFDFDF"
                      Header="Page margins">

                <Grid>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="35"/>
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Text="Top:"/>
                    <TextBox x:Name="_pageMarginTopTextBox" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageMargins.Top, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Row="0" Grid.Column="2" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>
                    
                    <TextBlock Grid.Row="0" Grid.Column="3" Margin="0,5,5,5" VerticalAlignment="Center" Text="Bottom:"/>
                    <TextBox x:Name="_pageMarginBottomTextBox" Grid.Row="0" Grid.Column="4" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageMargins.Bottom, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Row="0" Grid.Column="5" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>
                    
                    <TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Text="Left:"/>
                    <TextBox x:Name="_pageMarginLeftTextBox" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageMargins.Left, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Row="1" Grid.Column="2" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>
                    
                    <TextBlock Grid.Row="1" Grid.Column="3" Margin="0,5,5,5" VerticalAlignment="Center" Text="Right:"/>
                    <TextBox x:Name="_pageMarginRightTextBox" Grid.Row="1" Grid.Column="4" VerticalAlignment="Center" TextAlignment="Right"
                             Text="{Binding Path=prop_PageMargins.Right, Mode=OneTime, Converter={StaticResource LengthConverter}}"/>
                    <TextBlock Grid.Row="1" Grid.Column="5" Margin="5,0,0,0" VerticalAlignment="Center" Text="cm"/>
                    
                </Grid>

            </GroupBox>

        </StackPanel>

        <Border Grid.Row="3"
                Padding="3,0,3,1"
                SnapsToDevicePixels="True"
                BorderThickness="0,1,0,0"
                BorderBrush="#FFDFDFDF"
                Background="#FFF0F0F0">

            <StackPanel Orientation="Horizontal" FlowDirection="RightToLeft">
                <StackPanel.Resources>
                    <Style TargetType="Button">
                        <Setter Property="Margin" Value="8" />
                        <Setter Property="Padding" Value="15,0,15,0" />
                        <Setter Property="MinWidth" Value="80" />
                    </Style>
                </StackPanel.Resources>
                <Button x:Name="_cancelButton" IsCancel="True" Content="Cancel"/>
                <Button x:Name="_okButton" IsDefault="True" Content="OK" Click="okButton_Click"/>
                <Button x:Name="_setDefaultButton" Content="Set as defaults" Click="setDefaultButton_Click" />
            </StackPanel>

        </Border>

    </Grid>
    
</Window>
